<template>
  <div class="bg-white my-[10px]">
    <BaseHead style="border-bottom: 0">出账合同</BaseHead>
    <el-table :data="detailData.buyerContractList" class="w-full" border stripe>
      <el-table-column type="index" label="序号" width="60px" />
      <el-table-column prop="code" label="合同编号" />
      <el-table-column prop="name" label="合同名称">
        <template #default="{ row }">
          <el-link type="primary" @click="handleViewContract(row.id)">{{ row.name }}</el-link>
        </template>
      </el-table-column>
      <el-table-column prop="chargerName" label="合同负责人" />
      <el-table-column prop="authorizeDate" label="签订日期" />
      <el-table-column prop="feeAuthorize" label="合同金额（万元）" />
      <el-table-column label="所属单位">
        <template #default="{ row }">
          <CommonTreeLabel
            :value="row.unitId"
            :dataList="allUnitList"
            valueKey="codeColumn"
            labelKey="valueColumn"
          />
        </template>
      </el-table-column>
      <el-table-column prop="" label="审核状态">
        <template #default="{ row }">
          <CommonLabel
            :dataList="checkStatusList"
            valueKey="dictValue"
            labelKey="dictLabel"
            :value="row.checkstatus"
          />
        </template>
      </el-table-column>
    </el-table>
  </div>
  <ViewContractModal ref="viewContractModalRef" />
</template>

<script setup>
import BaseHead from "@/views/project/components/BaseHead.vue";
import CommonTreeLabel from "@/views/project/components/CommonTreeLabel.vue";
import CommonLabel from "@/views/project/components/CommonLabel.vue";
import { contractDetail } from "@/api/project/zx/lxxm";
import ViewContractModal from "@/views/project/yf/czhtqd/components/ViewModal.vue";
const operateId = inject("id");
const allUnitList = inject("allUnitList");
const checkStatusList = inject("checkStatusList");
const detailData = ref({});
const viewContractModalRef = ref();
//获取信息详情
const getDetail = async () => {
  try {
    const res = await contractDetail(operateId.value);
    detailData.value = res.data;
  } catch (error) {
    console.log(error);
  }
};
//点击出账合同名称
const handleViewContract=(id)=>{
  viewContractModalRef.value.view(id);
}
onMounted(() => {
  getDetail();
});
</script>

<style scoped lang="scss"></style>
